package MyWizard;

import java.awt.Component;
import java.awt.GridLayout;
import java.util.List;
import java.util.Map;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.netbeans.spi.wizard.Wizard;
import org.netbeans.spi.wizard.WizardPage;
import org.netbeans.spi.wizard.WizardPanelNavResult;

public class Page1 extends WizardPage {

    private JComboBox tables;

    public Page1() {
        JPanel pnl = new JPanel();
        pnl.setLayout(new GridLayout(0, 2));

        List<String> t = WizardDemo.db.getTables();
        pnl.add(new JLabel("Select table : "));
        tables = new JComboBox(t.toArray());
        tables.setName("table");
        pnl.add(tables);
        add(pnl);
    }

    @Override
    public WizardPanelNavResult allowNext(String stepName, Map settings, Wizard wizard) {
        WizardDemo.table=tables.getSelectedItem().toString();
        return super.allowNext(stepName, settings, wizard);
    }



    public static final String getDescription() {
        return "Table";
    }

    @Override
    protected String validateContents(Component comp, Object o) {
        return null;
    }
}
